home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 May / EnigmA AMIGA RUN 18 (1997)(G.R. Edizioni)(IT)[!][issue 1997-05][EAR-CD II].iso / softwareupdate / system / amigados / amigadoslibrary / fputs.c < prev    next >
C/C++ Source or Header  |  1996-10-10  |  767b  |  40 lines

  1. /* FPuts.c   V1.1   93-03-03                   */
  2. /* ROM library: "dos.library/FPuts", (V36+)    */
  3. /* Copyright 1993, Anders Bjerin, Amiga C Club */
  4.  
  5. #include <dos/dos.h>
  6.  
  7. #include <clib/dos_protos.h>
  8. #include <stdio.h>
  9. #include <stdlib.h>
  10.  
  11. UBYTE *version = "$VER: FPuts 1.1";
  12.  
  13. int main( int argc, char *argv[] );
  14. int main( int argc, char *argv[] )
  15. {
  16.   BPTR my_file;
  17.   int error_code;
  18.  
  19.  
  20.   /* Open a new file: */
  21.   my_file = Open( "RAM:Shakespeare.doc", MODE_NEWFILE );
  22.   if( !my_file )
  23.     exit( 20 );
  24.  
  25.   /* Store a string: */
  26.   error_code = FPuts( my_file, "To be, or not to be..." );
  27.  
  28.   /* OK? */
  29.   if( error_code == -1 )  
  30.     printf( "Error while writing!\n" );
  31.   else
  32.     printf( "The string was successfully saved!\n" );
  33.  
  34.   Close( my_file );
  35.  
  36.   exit( 0 );
  37. }
  38.  
  39.  
  40.